<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>展览基本信息修改</title>
<link href="../style/css_member.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/common.js"></script>
<script src="../js/artDialog.js?skin=gray"></script>
<script src="../js/artDialog.iframeTools.js"></script>
<script type="text/javascript" src="../js/jquery-1.3.2.js"></script>
<script language="javascript" type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>

<script type="text/javascript">

	function checkForm(){

		var title = $.trim($("#title").val());
		if( title  ==  ""){
			$("#title").focus();
			 alert("请填写展览主题。");
			 return false;
		}

		var description = $.trim($("#description").val());
		if( description  ==  ""){
			$("#description").focus();
			 alert("请填写序言。");
			 return false;
		}

		var picImage = $("#picImage").val();
		if( picImage == "" ){
			alert("请上传展览海报图片");
			return false;
		}

		var province = $("#provinceInfoSelect").val();
		if( province == ""){
			 alert("请选择展览所在省。");
			 return false;
		}

		var city = $("#cityInfoSelect").val();
		if( city == ""){
			 alert("请选择展览所在市。");
			 return false;
		}

		var beginTime = $.trim($("#beginTime").val());
		if( beginTime  ==  ""){
			 alert("请填写展览开始时间。");
			 return false;
		}

		var endTime = $.trim($("#endTime").val());
		if( endTime  ==  ""){
			 alert("请填写展览结束时间。");
			 return false;
		}

		if(window.confirm("确认修改？")){
			$.ajax({
				type:'POST',
				url:'${ctx }/exhibition/modify.do',
				async : false, //ajax同步
				data:$("#exhibitionForm").serialize(),//序列化表单里所有的内容
				success: function(data){
				  if(data =='0000'){
		    			alert("展览基本信息保存成功！");
		    			var win = art.dialog.open.origin;//来源页面
						// 如果父页面重载或者关闭其子对话框全部会关闭
						win.location.reload();
						return false;
					}else{
						alert("展览基本信息保存失败！");
						return false;
					}
				}
			});
		}
	}

	$(function(){

		$("#exhibitionLink").click(function(){
			art.dialog.open('${ctx}/fileUpload!uploadPrepare.do?imgType=exhibition&sharpId=7',{title:'修改展览海报图片',width:800,height:550},false);
	    });

		var city_id = '${exhibition.cityInfo.id}';
		checkCity(city_id);
	});

</script>
</head>

<body>

<form action="${ctx }/exhibition/modify.do" method="post" id="exhibitionForm" name="exhibitionForm" enctype="multipart/form-data">
<table width="800" border="0" cellpadding="0" cellspacing="1" bordercolor="#CCCCCC" bgcolor="#CCCCCC">
      <tr>
        <td bgcolor="#FFFFFF"><table width="800" border="0" cellspacing="0" cellpadding="0" align="left" class="addTable">
          <tr>
            <td colspan="100%" height="40" align="center"><span style="font-family: 宋体;font-size: 16px;" class="style15">展览《${exhibition.title}》基本信息修改</span></td>
          </tr>
	          <tr>
	            <td align="right" class="bt14A"><span class="style15">*</span>展览主题：</td>
	            <td><input name="exhibition.title" type="text" size="30" id="title" value="${exhibition.title }"  maxlength="50"></td>
	            <td  width="254" valign="top" rowspan="16"><div align="center" style="padding-bottom: 10px">
		             <table width="165" height="217" border="0" cellpadding="0" cellspacing="1" bordercolor="#CCCCCC" bgcolor="#CCCCCC">
	                  <tr>
	                    <td bgcolor="#FFFFFF">
	                    	<div id="photoTd" style="width: 165px;height: 220px;vertical-align: middle;text-align: center;overflow: hidden;">
	                    		<img width="165" height="220" src="${exhibition.imagepath}">
	                    	</div>
	                    </td>
	                  </tr>
	                </table>
              	</div></td>
              	<td  rowspan="16">&nbsp;</td>
	          </tr>
		      <tr>
		            <td  align="right" class="bt14A"><span class="style15">*</span>序言：</td>
		          	<td><textarea name="exhibition.description" cols="50" rows="5" id="description">${exhibition.description }</textarea></td>
	          </tr>     
              <tr> 
	               <td align="right" class="bt14A"><span class="style15">*</span>上传展览海报：</td>
	               <td  class="bt14A"><a id="exhibitionLink" style="cursor: pointer;color: red">上传</a></td>
               </tr>
               <tr>
	               	<td align="right"  class="bt14A"><span class="style15">*</span>参展艺术家：</td>
	                <td><input name="exhibition.artists" type="text" size="30" id="artists" value="${exhibition.artists }" maxlength="100"> <span class="style19">多个头衔请用，号分隔</span></td>
               </tr>
               <tr>
                	<td valign="top" class="bt14A" align="right"><span class="style15">* </span>所在地：</td>
                	<td valign="top" class="bt14A">
                  	<select name="exhibition.provinceInfo.id" id="provinceInfoSelect" onchange="changeProvince()">
                        <option value="">选择省份</option>
                        <c:forEach items="${provinceInfoList}" var="provinceInfo" varStatus="status">
				            <option value="${ provinceInfo.id}" <c:if test="${exhibition.provinceInfo.id == provinceInfo.id }">selected="selected"</c:if>/> ${ provinceInfo.name}</option>
				        </c:forEach>
                    </select>
                      <select name="exhibition.cityInfo.id" id="cityInfoSelect">
                        <option value="">选择县市</option>
                      </select>
                	</td>
                </tr>
                <tr>
		            <td valign="top" class="bt14A" align="right"><span class="style15">*</span>展览地点：</td>
		            <td valign="top" class="bt14A"><input name="exhibition.address" type="text" size="40" id="address" value="${exhibition.address }" maxlength="200"></td>
          		</tr>
          		<tr>
		            <td valign="top" class="bt14A" align="right"><span class="style15">*</span>展览时间：</td>
		            <td valign="top" class="bt14A">
		            	<input name="exhibition.beginTime" value="<fmt:formatDate value='${exhibition.beginTime }' pattern='yyyy-MM-dd'/>" type="text" size="15" id="beginTime"  onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})">开始至
               			<input name="exhibition.endTime"   value="<fmt:formatDate value='${exhibition.endTime }' pattern='yyyy-MM-dd'/>"  type="text" size="15" id="endTime" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})">结束
		            </td>
          		</tr>
               <tr>
              		<td align="right"  class="bt14A">策展人或单位：</td>
	                <td><input name="exhibition.publisher" type="text" size="30" id="publisher" value="${exhibition.publisher }">
	                 	  <!-- 隐藏域 begin -->
	            			<input name="exhibition.imageInfo.id" type="hidden"  id="picImage" value="${exhibition.imageInfo.id }">
	            			<input name="exhibition.id" type="hidden"  value="${exhibition.id }">
	            			<input name="exhibition.totalCount" type="hidden"  value="${exhibition.totalCount }">
	            			<input name="exhibition.unit" type="hidden"  value="${exhibition.unit }">
	            			<input name="exhibition.type" type="hidden"  value="${exhibition.type }">
	            	 	  <!-- 隐藏域 end -->
	               	 </td>
               </tr>
               <tr>
	                <td></td>
	                <td height="60"><img src="../images/an24.gif" width="114" height="31" onclick="javascript:checkForm();" style="cursor: pointer ;border: 0">
	                </td>
               </tr>
               <tr>
               		<td height="20">&nbsp;</td><td>&nbsp;</td>
               </tr>
        </table></td>
      </tr>
    </table>
</form>

</body>
</html>